//用户登录三个接口的对应调用方法
//axios调用
//import http from "../../utils/http/index";
// '@': path.resolve(__dirname, 'src'),
// @ = src 
import http from "@/utils/http/index";

interface CaptchaVo{
    image:string,
    key: string
}

//向后台发起请求
let getCaptchaCode = ()=>{
    return http.get<CaptchaVo>("/admin/login/captcha");
}


//登录参数接口
//参数类型
interface UserForm{
    username:string,
    password:string,
    captchaKey:string,
    captchaCode:string
}

//登录触发的请求方法
let userLogin = (userForm:UserForm)=>{
    // <返回值类型>
    return http.post<string>("/admin/login",userForm);
}


//定义获取用户信息
interface InfoData{
    name:string,
    avatarUrl:string
}

let userInfo =()=>{
   return http.get<InfoData>("/admin/info");
}



export {
    getCaptchaCode,
    // 属性 和 方法 直接写名称即可
    // typeScript接口 type CaptchaVo
    type CaptchaVo,
    type UserForm,
    userLogin,
    type InfoData,
    userInfo
}
